package com.mathlearning.auth.controller;

import com.mathlearning.auth.common.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/api/debug")
public class DebugController {

    @Autowired
    private Environment env;

    @GetMapping("/multipart")
    public ApiResponse<Map<String, Object>> multipart() {
        Map<String, Object> data = new HashMap<>();
        data.put("spring.servlet.multipart.max-file-size", env.getProperty("spring.servlet.multipart.max-file-size"));
        data.put("spring.servlet.multipart.max-request-size", env.getProperty("spring.servlet.multipart.max-request-size"));
        data.put("spring.servlet.multipart.location", env.getProperty("spring.servlet.multipart.location"));
        data.put("server.tomcat.max-http-form-post-size", env.getProperty("server.tomcat.max-http-form-post-size"));
        data.put("server.tomcat.max-swallow-size", env.getProperty("server.tomcat.max-swallow-size"));
        return ApiResponse.success("ok", data);
    }
}


